import request from "@/utils/request";

//  查询角色列表
export const getRoleListApi = (params) => {
  return request({
    url: "/sys/role",
    method: "get",
    params,
  });
};
//  查询角色详情
export const getRoleInfoApi = (id) => {
  return request({
    url: "/sys/role/" + id,
    method: "get",
  });
};
// 新增角色
export const addRoleApi = (data) => {
  return request({
    url: "/sys/role",
    method: "post",
    data,
  });
};
// 修改角色
export const editRoleApi = (data) => {
  return request({
    url: "/sys/role/" + data.id,
    method: "put",
    data,
  });
};
// 删除角色
export const delRoleApi = (id) => {
  return request({
    url: "/sys/role/" + id,
    method: "delete",
  });
};

// 查询企业信息
export const getCompanyInfo = (id) => {
  return request({
    url: "/company/" + id,
  });
};

// 给角色分配权限
// data { id 角色id  permIds 权限id数组 }
export const setRoleAuth = (data) => {
  return request({
    url: "/sys/role/assignPrem",
    method: "put",
    data,
  });
};
